dict = {
    'a': 1,
    'b': 4,
    'c': 2,
    'd': 12
}
a = sorted(dict.items(), key=lambda X: X[1])  # 从小到大
a1 = sorted(dict.items(), key=lambda X: X[1], reverse=True)  # 从大到小
print(a)
print(a1)
